package com.srzk.youthleagueback.mapper;

import com.srzk.youthleagueback.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface UserMapper {
    //获得用户信息
    @Select("select * from info where user = #{userName}")
    User getByUserName(@Param("userName") String userName);

    //设置用户信息
    @Insert("insert into info (uid, user, password, grade, class, " +
            "college) " +
            "values (#{user.uid}, #{user.userName}, " +
            "#{user.password}, #{user.grade}, #{user.className}," +
            " #{user.college})")
    void setUser(@Param("user") User user);
}
